home *** CD-ROM | disk | FTP | other *** search
- VERSION 2.00
- Begin Form LaunchBackground
- Caption = "Launch Background Program"
- ClientHeight = 2505
- ClientLeft = 2865
- ClientTop = 2970
- ClientWidth = 5205
- Height = 2910
- Left = 2805
- LinkTopic = "Form2"
- ScaleHeight = 2505
- ScaleWidth = 5205
- Top = 2625
- Width = 5325
- Begin CommandButton cmdClose
- Caption = "Close"
- Height = 435
- Left = 3120
- TabIndex = 3
- Top = 1740
- Width = 1215
- End
- Begin CommandButton cmdLaunch
- Caption = "Launch"
- Height = 435
- Left = 1320
- TabIndex = 2
- Top = 1740
- Width = 1155
- End
- Begin Timer Timer1
- Enabled = 0 'False
- Interval = 500
- Left = 360
- Top = 1740
- End
- Begin CheckBox Check1
- Caption = "Launch Hidden"
- Height = 315
- Left = 360
- TabIndex = 1
- Top = 900
- Value = 1 'Checked
- Width = 3435
- End
- Begin TextBox Text1
- Height = 315
- Left = 360
- TabIndex = 0
- Text = "command.com"
- Top = 360
- Width = 4095
- End
- Option Explicit
- Dim modulehandle%
- Sub cmdClose_Click ()
- Unload Me
- End Sub
- Sub cmdLaunch_Click ()
- Dim hideflag%
- If check1.Value = 1 Then hideflag% = SW_MINIMIZE Else hideflag% = SW_NORMAL
- ' Note, the hidden flag does not override the setting
- ' in the PIF file. Use the PIF file setting to
- ' create a DOS window that works in the background.
- modulehandle% = WinExec(Text1.Text, hideflag%)
- If modulehandle% <= 32 Then
- MsgBox "Not a valid executable"
- Exit Sub
- End If
- cmdLaunch.Enabled = False
- cmdClose.Enabled = False
- timer1.Enabled = True
- End Sub
- Sub Form_Load ()
- End Sub
- Sub Timer1_Timer ()
- If GetModuleUsage(modulehandle%) <> 0 Then Exit Sub
- modulehandle% = 0
- cmdLaunch.Enabled = True
- cmdClose.Enabled = True
- timer1.Enabled = False
- End Sub
-